package com.zhijian.medical.entity.vo.response;

import com.zhijian.medical.enums.PcrCovStatusEnum;
import com.zhijian.medical.enums.PcrKnbStatusEnum;
import com.zhijian.medical.enums.PcrTypeEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;
import java.util.Objects;

/**
 * 实验流程 回显vo
 *
 * @author HCG
 * @version 1.0
 * @date 2022-08-30 15:34:00
 */
@Getter
@Api(tags = "实验流程回显vo")
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PcrVo implements Serializable {

    private static final long serialVersionUID = -1;

    /**
     * 主键id
     */
    @ApiModelProperty("主键id")
    private Long id;

    /**
     * 流程编号
     */
    @ApiModelProperty("流程编号")
    private String processNumber;

    /**
     * 名称
     */
    @ApiModelProperty("名称")
    private String name;

    /**
     * 开始时间
     */
    @ApiModelProperty("开始时间")
    private String startTime;

    /**
     * 结束时间
     */
    @ApiModelProperty("结束时间")
    private String endTime;

    /**
     * 进度状态
     */
    @ApiModelProperty("进度状态")
    private Byte status;

    /**
     * 进度状态字符串
     */
    @ApiModelProperty("进度状态字符串")
    private String statusStr;

    /**
     * 操作者
     */
    @ApiModelProperty("操作者")
    private String operateUserName;

    /**
     * 类型，1：KNB，2：高危HPV，3：JAK2，4：肺癌5种，5：PIK3CA，6：新冠病毒
     */
    @ApiModelProperty("类型，1：KNB，2：高危HPV，3：JAK2，4：肺癌5种，5：PIK3CA，6：新冠病毒")
    private Byte type;

    /**
     * 创建时间
     */
    @ApiModelProperty("创建时间")
    private String createTime;

    /**
     * 修改时间
     */
    @ApiModelProperty("修改时间")
    private String updateTime;

    /**
     * 样本
     */
    @ApiModelProperty("样本")
    private List<ExperimentProcessSampleVo> experimentProcessSampleList;

    public void setId(Long id) {
        this.id = id;
    }

    public void setProcessNumber(String processNumber) {
        this.processNumber = processNumber;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setStartTime(String startTime) {
        this.startTime = startTime;
    }

    public void setEndTime(String endTime) {
        this.endTime = endTime;
    }

    public void setStatus(Byte status) {
        this.status = status;
    }

    public void setStatusStr(String statusStr) {
        if (Objects.isNull(this.status)) {
            this.statusStr = null;
            return;
        }
        if (Objects.isNull(type)) {
            PcrKnbStatusEnum anEnum = PcrKnbStatusEnum.getByCode(Integer.valueOf(this.status));
            this.statusStr = Objects.nonNull(anEnum) ? anEnum.getDesc() : null;
            return;
        }
        PcrTypeEnum pcrTypeEnum = PcrTypeEnum.getByCode(type.intValue());
        if (Objects.isNull(pcrTypeEnum)) {
            PcrKnbStatusEnum anEnum = PcrKnbStatusEnum.getByCode(Integer.valueOf(this.status));
            this.statusStr = Objects.nonNull(anEnum) ? anEnum.getDesc() : null;
            return;
        }
        switch (pcrTypeEnum) {
            case KNB:
                PcrKnbStatusEnum pcrKnbStatusEnum = PcrKnbStatusEnum.getByCode(Integer.valueOf(this.status));
                this.statusStr = Objects.nonNull(pcrKnbStatusEnum) ? pcrKnbStatusEnum.getDesc() : null;
                break;
            case GW_HPV:
                break;
            case FA_5:
                break;
            case JAK2:
                break;
            case PIK3CA:
                break;
            case COV:
                PcrCovStatusEnum pcrCovStatusEnum = PcrCovStatusEnum.getByCode(Integer.valueOf(this.status));
                this.statusStr = Objects.nonNull(pcrCovStatusEnum) ? pcrCovStatusEnum.getDesc() : null;
                break;
            default:
                PcrKnbStatusEnum anEnum = PcrKnbStatusEnum.getByCode(Integer.valueOf(this.status));
                this.statusStr = Objects.nonNull(anEnum) ? anEnum.getDesc() : null;
                break;
        }
    }

    public void setOperateUserName(String operateUserName) {
        this.operateUserName = operateUserName;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }

    public void setExperimentProcessSampleList(List<ExperimentProcessSampleVo> experimentProcessSampleList) {
        this.experimentProcessSampleList = experimentProcessSampleList;
    }
}